<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>运单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
        
        function dispatch(){
        	window.location.href = "${ctx}/tb_waybill/tbWaybill/dispatch/list";
        }
        
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/tb_waybill/tbWaybill/">运单列表</a></li>
		<shiro:hasPermission name="tb_waybill:tbWaybill:edit"><li><a href="${ctx}/tb_waybill/tbWaybill/form">运单添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="tbWaybill" action="${ctx}/tb_waybill/tbWaybill/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>创建时间：</label>
				<input name="beginCreateDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${tbWaybill.beginCreateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/> - 
				<input name="endCreateDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${tbWaybill.endCreateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="btns"><input id="btn" class="btn btn-primary" type="button" value="调度"  onclick="dispatch();"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>订单编号</th>
				<th>车辆/挂车</th>
				<th>托运方</th>
				<th colspan="2">装货地址</th>
				<th colspan="3">收货单位</th>
				<th colspan="3">收货地址</th>
				<th colspan="3">品名</th>
				<th colspan="3">重量(吨/t)</th>
				<th colspan="3">运价</th>
				<th colspan="3">运费</th>
				<th>出车时间</th>
				<th>创建时间</th>
				<th>更新时间</th>
				<th>备注</th>
				<th>运单状态</th>
				<shiro:hasPermission name="tb_waybill:tbWaybill:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="tbWaybill">
			<tr>
				<td><a href="${ctx}/tb_waybill/tbWaybill/form?id=${tbWaybill.id}">
					${tbWaybill.waybillNum}
				</a></td>
				<td>${tbWaybill.tbCarInfo.carCode }/${tbWaybill.tbCarInfo.carGCode }</td>
				<td>${tbWaybill.tbGoodsConsignmentCompany.shortName}</td>
				<%--装货地址 --%>
				<td>${tbWaybill.tbLoadingAddress.shortName}</td>
				<td>${tbWaybill.tbLoadingAddressTwo.shortName}</td>
				<%--装货地址 end--%>
				<%--收货公司 --%>
				<td>${tbWaybill.tbWaybillDetailOne.tbGoodsReceiptCompany.shortName }</td>
				<td>${tbWaybill.tbWaybillDetailTwo.tbGoodsReceiptCompany.shortName }</td>
				<td>${tbWaybill.tbWaybillDetailThree.tbGoodsReceiptCompany.shortName }</td>
				<%--收货公司 结束--%>
				<%--收货地址 --%>
				<td>${tbWaybill.tbWaybillDetailOne.tbDischargeCargoAddress.shortName }</td>
				<td>${tbWaybill.tbWaybillDetailTwo.tbDischargeCargoAddress.shortName }</td>
				<td>${tbWaybill.tbWaybillDetailThree.tbDischargeCargoAddress.shortName }</td>
				<%--收货地址 end--%>
				<%--品名 --%>
					<td>${tbWaybill.tbWaybillDetailOne.tbGoods.goodName }</td>
					<td>${tbWaybill.tbWaybillDetailTwo.tbGoods.goodName }</td>
					<td>${tbWaybill.tbWaybillDetailThree.tbGoods.goodName }</td>
				<%--品名 end--%>
				<%--重量 --%>
					<td>${tbWaybill.tbWaybillDetailOne.weight }</td>
					<td>${tbWaybill.tbWaybillDetailTwo.weight }</td>
					<td>${tbWaybill.tbWaybillDetailThree.weight }</td>
				<%--重量 end--%>
				<%--运价 --%>
					<td>${tbWaybill.tbWaybillDetailOne.unitPrice }</td>
					<td>${tbWaybill.tbWaybillDetailTwo.unitPrice }</td>
					<td>${tbWaybill.tbWaybillDetailThree.unitPrice }</td>
				<%--运价 end--%>
				<%--运费 --%>
					<td>${tbWaybill.tbWaybillDetailOne.money }</td>
					<td>${tbWaybill.tbWaybillDetailTwo.money }</td>
					<td>${tbWaybill.tbWaybillDetailThree.money }</td>
				<%-- 运费end--%>
				<td>
					<fmt:formatDate value="${tbWaybill.outCarTime}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
					<fmt:formatDate value="${tbWaybill.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${tbWaybill.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${tbWaybill.remarks}
				</td>
				<td>${fns:getDictLabel(tbWaybill.state, 'waybill_state', '')}</td>
				<shiro:hasPermission name="tb_waybill:tbWaybill:edit"><td>
    				<a href="${ctx}/tb_waybill/tbWaybill/form?id=${tbWaybill.id}">修改</a>
					<a href="${ctx}/tb_waybill/tbWaybill/delete?id=${tbWaybill.id}" onclick="return confirmx('确认要删除该运单吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>